* {
  box-sizing: border-box;
}
body {
  background-color: lightgreen;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  overflow: hidden;
  margin: 0;
}
.search {
  position: relative;
  height: 50px;
}
.search .input {
  background-color: #fff;
  border: 0;
  font-size: 18px;
  padding: 15px;
  width: 50px;
  height: 50px;
  transition: width 0.3s ease;
}
.search .input:focus {
  outline: 0;
}
button {
  background-color: #fff;
  border: 0;
  cursor: pointer;
  font-size: 24px;
  position: absolute;
  top: 0;
  left: 0;
  height: 50px;
  width: 50px;
  transition: transform 0.3s ease;
}
button img {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 40px;
  height: 40px;
}
.search.active .input {
  /* search中有active 这个才会生效 */
  width: 200px;
}
.search.active button {
  transform: translateX(198px);
}